<?php
$con=mysql_connect("localhost", "smidpet5", "aez9okai");
// Check connection
if (!$con)
  {
  echo "Failed to connect to MySQL: " . mysql_connect_error();
  }

// Create database
mysql_select_db("smidpet5");


$sql="CREATE TABLE users(Id INT,Jmeno CHAR(30),Heslo CHAR(30))";


if (mysql_query($sql,$con))
  {
  echo "Table users created successfully";
  }
else
  {
  echo "Error creating table: " . mysql_error($con);
  } 
  
mysql_query("INSERT INTO users(Id, Jmeno, Heslo)VALUES (1, 'Pevita',asdf)",$con);
mysql_query("INSERT INTO users(Id, Jmeno, Heslo)VALUES (2, 'Pevitap',asdf)",$con);
mysql_query("INSERT INTO users(Id, Jmeno, Heslo)VALUES (3, 'Pevitapet',asdf)",$con);
mysql_close($con)     
?>
  
  
<?php
$con=mysql_connect("localhost", "smidpet5", "aez9okai");
// Check connection
if (!$con)
  {
  echo "Failed to connect to MySQL: " . mysql_connect_error();
  }

// Create database
mysql_select_db("smidpet5");


$sql="CREATE TABLE BMI(Id INT,Jmeno CHAR(30),Vyska CHAR(30),Vaha CHAR(30),BMI FLOAT,userid INT)";


if (mysql_query($sql,$con))
  {
  echo "Table BMI created successfully";
  }
else
  {
  echo "Error creating table: " . mysql_error($con);
  }
     
mysql_query("INSERT INTO BMI(Id, Jmeno, Vyska, Vaha, BMI, userid)VALUES (1,'Pevi', 195, 100, 26.4, 1)",$con);
mysql_query("INSERT INTO BMI(Id, Jmeno, Vyska, Vaha, BMI, userid)VALUES (1,'Pevtap', 195, 100, 26.4, 2)",$con);
mysql_query("INSERT INTO BMI(Id, Jmeno, Vyska, Vaha, BMI, userid)VALUES (1,'Pevitape', 195, 100, 26.4, 3)",$con);
mysql_close($con)
?> 
